home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c
- Path: phcoms4.seri.philips.nl!misf1!Pvestjen
- From: Pvestjen@ms.philips.nl (Patrick Vestjens)
- Subject: Re: Checking for Ilegal Input
- Message-ID: <1996Mar14.154854.15488@ms.philips.nl>
- Sender: news@ms.philips.nl
- Organization: Philips Medical Systems, Best
- X-Newsreader: TIN [version 1.2 PL2]
- References: <313855C7.5E86@aol.com> <4i49fa$819@info-server.bbn.com>
- Date: Thu, 14 Mar 1996 15:48:54 GMT
-
- Anita Hsiung (ahsiung@bbn.com) wrote:
- : Why not try:
-
- : char *resp; /* do some memory allocation */
- : while ( (resp < '0') || (resp > '15') ) {
- : printf("Enter a again:");
- : scanf("%s", &resp);
- : }
-
- Hm, are you sure about this? First of all you are comparing a pointer to
- a character to a character constant. Then you compare the same pointer
- to a multi-byte character that probably should not be a multi-byte
- character. Finally, you are storing the string just read at the address
- of the pointer to the first character of the string, this should have
- been 'resp' instead of '&resp' in my opinion.
-
- Regards, Patrick.
-
-